feat: Support always fetching a standalone python interpreter#1663
Draft
feat: Support always fetching a standalone python interpreter#1663
Conversation
7e648ec to
43cad9a
Compare
There exist environments where users need known "good" python
interpreters to run their commands from. Notably, linux distros _can_
package non-standard alterations to their Python interpreters, or not
have certain "optional" features.
This commit adds `--fetch-python={always, missing, never}` and the
associated environment variable `PIPX_FETCH_PYTHON`.
`--fetch-missing-python` has been deprecated and aliased to
`--fetch-python=missing`. The corresponding change has been made to
`PIPX_FETCH_MISSING_PYTHON`.
StrEnum only available in 3.11 :(
43cad9a to
435519d
Compare
1 task
4279653 to
5cc32a6
Compare
gaborbernat
reviewed
Mar 18, 2026
|
|
||
|
|
||
| # XXX: Python 3.11 StrEnum + enum.auto() | ||
| class FetchPythonOptions(str, enum.Enum): |
Contributor
There was a problem hiding this comment.
Contributor
Author
There was a problem hiding this comment.
older python versions don't support it, at the time pipx still supported those versions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
changelog.d/(if the patch affects the end users)Summary of changes
There exist environments where users need known "good" python interpreters to run their commands from. Notably, linux distros can package non-standard alterations to their Python interpreters, or not have certain "optional" features.
This commit adds
--fetch-python={always, missing, never}and the associated environment variablePIPX_FETCH_PYTHON.--fetch-missing-pythonhas been deprecated and aliased to--fetch-python=missing. The corresponding change has been made toPIPX_FETCH_MISSING_PYTHON.N.b. happy to bikeshed on the name.
Test plan
Tested by running (on a machine with and without python3.{9,10,11}, with and without the environment variable
N.b. ran those commands with #1662 cherry picked.
I am happy to add automatic tests as well, I just don't know exactly what would be preferred / which cases you'd like tested. Happy to add any tests requested.